package com.nfIt.Callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * ClossName:mainTest
 * Pakage:com.nfIt.Callable
 * Description
 *
 * @Author L
 * @Create 2024/3/19 14:49
 * @Version 2023.1.3
 */
public class mainTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyRed t1 = new MyRed();

        FutureTask<Integer> futureTask1 = new FutureTask<>(t1);
        FutureTask<Integer> futureTask2 = new FutureTask<>(t1);
        FutureTask<Integer> futureTask3 = new FutureTask<>(t1);


        Thread thread1 = new Thread(futureTask1);
        Thread thread2 = new Thread(futureTask2);
        Thread thread3= new Thread(futureTask3);



        thread1.start();
        thread2.start();
        thread3.start();

        Integer red = futureTask1.get();
        Integer green = futureTask2.get();
        Integer blue = futureTask3.get();

        System.out.println("红色"+red+"绿色"+green+"蓝色"+blue);
    }
}
